/*
 * TeamSpeak 3 Dice Plugin by CintasFox
 *
 * Copyright (c) 2011 CintasFox
 */

#ifndef PLUGIN_H
#define PLUGIN_H

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include <malloc.h>
#include "public_errors.h"
#include "public_definitions.h"
#include "public_rare_definitions.h"
#include "ts3_functions.h"
#include "plugin_events.h"

#ifndef _WINDOWS
#define sprintf_s snprintf;
#define strcpy_s(dest, destSize, src) { strncpy(dest, src, destSize-1); dest[destSize-1] = '\0'; }
#define sscanf_s sscanf;
#define strtok_s(workString, delimiter, Safespot) strtok(workString, delimiter);
#endif

#ifndef WIN32
#define __declspec(dllexport) {__attribute__ ((visibility("default")))}
#endif

#ifdef __cplusplus
extern "C" {
#endif

#include "AnswerClass.h"

static struct TS3Functions ts3Func;

static char* pluginID = NULL;

static Answer* Antwort = NULL;

static int* Failure = NULL;

_invalid_parameter_handler pNew,pOld;

/* Required functions */
int roleDice(int sides);

void Antworten(uint64 serverConnectionHandlerID, anyID targetMode, anyID fromID, anyID toID);
void myInvalidParameterHandler(const wchar_t* expression, const wchar_t* function, const wchar_t* file, unsigned int line, uintptr_t pReserved) throw (char*);

__declspec(dllexport) const char* ts3plugin_name();
__declspec(dllexport) const char* ts3plugin_version();
__declspec(dllexport) int ts3plugin_apiVersion();
__declspec(dllexport) const char* ts3plugin_author();
__declspec(dllexport) const char* ts3plugin_description();
__declspec(dllexport) void ts3plugin_setFunctionPointers(const struct TS3Functions funcs);
__declspec(dllexport) int ts3plugin_init();
__declspec(dllexport) void ts3plugin_shutdown();

/* Optional functions */
//__declspec(dllexport) void ts3plugin_registerPluginID(const char* id);
__declspec(dllexport) const char* ts3plugin_commandKeyword();
__declspec(dllexport) int ts3plugin_requestAutoload();

/* TeamSpeak callbacks */
__declspec(dllexport) void ts3plugin_onConnectStatusChangeEvent(uint64 serverConnectionHandlerID, int newStatus, unsigned int errorNumber);
__declspec(dllexport) int  ts3plugin_onTextMessageEvent(uint64 serverConnectionHandlerID, anyID targetMode, anyID toID, anyID fromID, const char* fromName, const char* fromUniqueIdentifier, const char* message, int ffIgnored);

}

#endif